
package com.probiz.estore.core.security;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.acegisecurity.util.FilterToBeanProxy;

public class ProbizFilterToBeanProxy extends FilterToBeanProxy {
	private String paramName="doAction";
	public void init(FilterConfig filterConfig) throws ServletException {
		paramName=filterConfig.getInitParameter("paramName");
		super.init(filterConfig);
	}
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		if(req.getMethod().equalsIgnoreCase("POST")){
			req = new ProbizHttpServletRequestWrapper((HttpServletRequest) request,paramName);
		}
		super.doFilter(req, response, chain);
	}
}
